package org.sgsm.dungeon.generator.generator;

import java.util.HashSet;

import org.sgsm.dungeon.generator.ObjectType;
import org.sgsm.dungeon.generator.ServiceType;
import org.sgsm.dungeon.generator.method.Method;
import org.sgsm.dungeon.generator.util.util.Generator;

public abstract class AbstractServiceGenerator extends Generator
{

  public abstract void generate(ServiceType pService);

  public void generateImport(ServiceType pService)
  {
    HashSet<String> importList = new HashSet<String>();
    for (Method method: pService.getMethodList())
    {
      if (!method.getObjetOut().getName().equals("void"))
      {
        importList.add(method.getObjetOut().getImport());
      }
      for (ObjectType obj: method.getObjetIn())
      {
        importList.add(obj.getImport());
      }
    }
    for (String impor: importList)
    {
      print("import " + impor + ";");
    }
  }
}
